import { CommonStatus } from "/@/api/models";

export enum MenuType {
  MENU = "MENU",
  CATALOG = "CATALOG",
  BUTTON = "BUTTON",
}

export interface MenuItem {
  id: number;
  key: string;
  parentId: number;
  name: string;
  type: MenuType | "";
  path: string;
  sort: number;
  visible: number;
  icon: string;
  perm: string;
  children: MenuItem[] | undefined;
}

export interface RouteItem {
  path: string;
  name: string;
  meta: {
    title: string;
    icon: string;
    roles: string[];
    hidden: boolean;
  };
  sort: number;
  children: RouteItem[] | undefined;
}

export interface ParamItem {
  id: number;
  name: string;
  model: string;
  param: string;
  description: string;
  createTime: number;
}

export enum DictTypeCode {
  region = "1",
  productCategory = "2",
  measurementUnit = "3",
  mallClass = "4",
}

export interface DictItem {
  key: string;
  id: number;
  name: string;
  value: string;
  parentId: number;
  sort: number;
  remark: string;
  status: CommonStatus;
  children?: DictItem[];
  typeCode: DictTypeCode;
  icon: string;
}

export enum DeptType {
  company = 1,
  cooperation = 2,
}

export interface DeptItem {
  key: string;
  id: number;
  parentId: number;
  name: string;
  sort: number;
  status: CommonStatus;
  type: DeptType;
  children?: DeptItem[];
}

export interface RoleItem {
  id: number;
  name: string;
  code: string;
  status: CommonStatus;
  sort: number;
  menuIds: number[];
}

export interface UserItem {
  id: number;
  username: string;
  nickname: string;
  avatar: string;
  deptId: number;
  deptName: string;
  roleIds: number[];
  dataGroupIds: number[];
  roleNames: string;
  mobile: string;
  email: string;
  gender: 1 | 2;
  status: CommonStatus;
  createTime: string;
}

export interface DataGroupItem {
  id: number;
  name: string;
  code: string;
  sort: number;
  status: CommonStatus;
  deptIds: string;
  dictIds: string;
  dataIds: {
    deptIds: number[];
    dictIds: number[];
  };
}
